import { RouteRecordRaw } from "vue-router";

export const dynamicRoutes: Array<RouteRecordRaw> = [
  {
    name: "system",
    path: "/system",
    redirect: "/home",
    component: () => import("@/components/layout.vue"),
    children: [
      {
        name: "home",
        path: "/home",
        meta: {
          title: "首页",
          keepAlive: false,
        },
        component: () => import("@/views/home/home.vue"),
      },
      {
        name: "management",
        path: "/management",
        redirect: "/management/user",
        meta: {
          title: "管理",
          keepAlive: false,
        },
        children: [
          {
            name: "user",
            path: "/management/user",
            meta: {
              title: "用户管理",
              keepAlive: false,
            },
            component: () => import("@/views/management/user.vue"),
          },
          {
            name: "department",
            path: "/management/department",
            meta: {
              title: "部门管理",
              keepAlive: false,
            },
            component: () => import("@/views/management/user.vue"),
          }
        ],
      }
    ]
  },

];

export const staticRoutes: Array<RouteRecordRaw> = [
  {
    path: "/",
    redirect: "/login",
  },
  {
    name: "login",
    path: "/login",
    meta: {
      title: "登录",
      keepAlive: false,
    },
    component: () => import("@/views/login.vue"),
  },
];

export const routes: Array<RouteRecordRaw> = [
  ...staticRoutes,
  ...dynamicRoutes
];
